﻿using System;
using System.Data;
using System.Data.SqlClient;
using DevExpress.XtraReports.UI;
using prjKQXS_DLL;

namespace prjKQXS_Report.Truyen_thong
{
    public partial class rptTongHopTT_CB : XtraReport
    {
        public DataTable dtSource;
        public string TyLe = "";

        public rptTongHopTT_CB()
        {
            InitializeComponent();
        }

        private void rptTonghHopTTCB_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e)
        {
            xrlblDonVi.Text = "Phòng XSKT: " + pTenDV.Value.ToString();
            xrlblNgay.Text = "Từ ngày " + ((DateTime)pTuNgay.Value).ToString("dd/MM/yyyy") 
                + " đến ngày " + ((DateTime)pDenNgay.Value).ToString("dd/MM/yyyy");

            lblHT.Text = TyLe;           
            Report_DAL report_dal = new Report_DAL();
            dsReports dsReports1 = new dsReports();
            dsReports1 = report_dal.reportDungChung(dsReports1);

            dsReports1.Tables.Remove("TruyenThong");
            dsReports1.Tables.Add(dtSource);
            this.DataSource = dsReports1;
            this.DataMember = "TruyenThong";
        }

        public int flag = 0;
        decimal htDetails = 0;
        private void Detail_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e)
        {
            flag++;
            htDetails += (decimal)clsCommon.Parse(lblHT1.Text, 3);
        }

        private void xrtcSTTCB_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e)
        {
            xrtcSTTCB.Text = (++flag).ToString();
        }  
     
    }
}
